#Boa:Dialog:Dialog1

import wx
import wx.grid

def create(parent):
    return Dialog1(parent)

[wxID_DIALOG1, wxID_DIALOG1BUTTON1, wxID_DIALOG1BUTTON2, wxID_DIALOG1GRID1, 
 wxID_DIALOG1STATICTEXT1, 
] = [wx.NewId() for _init_ctrls in range(5)]

class Dialog1(wx.Dialog):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_DIALOG1, name='', parent=prnt,
              pos=wx.Point(387, 143), size=wx.Size(802, 415),
              style=wx.DEFAULT_DIALOG_STYLE, title='Cliente Alta - VERIFICAR')
        self.SetClientSize(wx.Size(794, 388))

        self.staticText1 = wx.StaticText(id=wxID_DIALOG1STATICTEXT1,
              label='Se han detectado clientes con nombres similares. Verifique que no haya sido dado de alta:',
              name='staticText1', parent=self, pos=wx.Point(16, 8),
              size=wx.Size(432, 13), style=0)

        self.grid1 = wx.grid.Grid(id=wxID_DIALOG1GRID1, name='grid1',
              parent=self, pos=wx.Point(16, 24), size=wx.Size(760, 328),
              style=0)

        self.button1 = wx.Button(id=wxID_DIALOG1BUTTON1, label='Nuevo Cliente',
              name='button1', parent=self, pos=wx.Point(8, 360),
              size=wx.Size(88, 23), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnNuevoCliente,
              id=wxID_DIALOG1BUTTON1)

        self.button2 = wx.Button(id=wxID_DIALOG1BUTTON2, label='Cancelar Alta',
              name='button2', parent=self, pos=wx.Point(688, 360),
              size=wx.Size(89, 23), style=0)
        self.button2.Bind(wx.EVT_BUTTON, self.OnCancelarAlta,
              id=wxID_DIALOG1BUTTON2)

    def __init__(self, parent, lista):
        self._init_ctrls(parent)
        self.crearGrilla()
        self.repuesta = False

    def autosizegrilla(self):
        for i in xrange(self.grid1.GetNumberCols()):
            self.grid1.AutoSizeColumn(i,True)
        self.grid1.Refresh()
        
    def crearGrilla(self):
        #Nombre,ID,DNI,Direccion,Localidad,Telefono
        #0      1  2   3         4         5
        columnas =['Nombre','Nro.Cliente','Nro.Doc.','Direccion','Localidad','Telefono']
        self.grid1.CreateGrid(1,len(columnas))
        for i, col in enumerate(columnas): 
            self.grid1.SetColLabelValue(i, col)
        self.grid1.EnableEditing(False)
        self.grid1.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)
        self.autosizegrilla()

    def OnNuevoCliente(self, event):
        self.repuesta = True

    def OnCancelarAlta(self, event):
        self.repuesta = False
        
    def getRepuesta(self):
        return self.repuesta
    

